﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim rs,sql,Runtxt,id,classid
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

	Runtxt=qingtian.RunStr
    		id = Request("id")    
    		If id = "" Then id = 1
   		If Not IsNumeric(id) Then id = 1
    		id = CLng(id)
    		If id < 1 Then id = 1

%>
	<card title="编辑软件资源"><p align="left">
编辑软件资源.
<br/>----------------<br/>
<%
		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_fileli where id="&id&""
		rs.open sql,conn,1,1
		if not (rs.eof and rs.bof) then
		dim rs2,sql2,i
	%>
   	所属分类:
	<%
	  set rs2=server.CreateObject("adodb.recordset")
	  sql2="select id,name from qingtian_phonefen Order by id desc"
	  rs2.open sql2,conn,1,1
	  if not (rs2.bof and rs2.eof) then
	  For i=1 to rs2.RecordCount
		if i=1 then
		%>
		<select name="cid<%=Runtxt%>" value="<%=rs("leiid")%>">               
		<%
		end if
                if rs2("id")=rs("leiid") then
                boddyy1="<option value='"&rs2("id")&"'>"&qingtian.utf8(rs2("name"))&"</option>"
                else
                boddyy=boddyy&"<option value='"&rs2("id")&"'>"&qingtian.utf8(rs2("name"))&"</option>"
                end if                
	  Rs2.MoveNext
	  Next
                Response.Write boddyy1
                Response.Write boddyy
	else
	%>
		<select name="cid<%=Runtxt%>" value="">
	<%

	  end if
	  Rs2.close
	  set rs2=nothing
	%>
	</select><br/>
	是否推荐:
   	<select name="tuijian<%=Runtxt%>" value="<%=rs("tuijian")%>">
	<option value="0">否</option>
	<option value="1">是</option>
	</select><br/>
	软件名称:<br/>
	<input emptyok="true"  name="name<%=Runtxt%>"  value="<%=qingtian.FormatEdit(rs("name"))%>" type="text"/><br/>
	软件说明:<br/>
	<input emptyok="true"  name="txt<%=Runtxt%>"  value="<%=qingtian.FormatEdit(rs("content"))%>" type="text"/><br/>
	文件截图:<br/>
	<input emptyok="true"  name="tuurl<%=Runtxt%>"  value="<%=qingtian.FormatEdit(rs("tuurl"))%>" type="text"/><br/>
	软件收费:
   	<select name="vip<%=Runtxt%>" value="<%=rs("vip")%>">
	<option value="0">否</option>
	<option value="1">是</option>
	</select><br/>
	购买金币:<br/>
	<input emptyok="true"  name="zf<%=Runtxt%>"  value="<%=rs("zf")%>" type="text"/><br/>
	VIP会员查看:
   	<select name="viphy<%=Runtxt%>" value="<%=rs("viphy")%>">
	<option value="0">否</option>
	<option value="1">是</option>
	</select><br/>
	软件作者:<br/>
	<input emptyok="true"  name="zuozhe<%=Runtxt%>"  value="<%=qingtian.FormatEdit(rs("zuozhe"))%>" type="text"/><br/>
	软件来源:<br/>
	<input emptyok="true"  name="laiyuan<%=Runtxt%>"  value="<%=qingtian.FormatEdit(rs("laiyuan"))%>" type="text"/><br/>
	<anchor>确定提交
    	<go href="editfilelist1.asp?Action=login&amp;id=<%=id%>&amp;classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="cid" value="$(cid<%=Runtxt%>)"/>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="tuijian" value="$(tuijian<%=Runtxt%>)"/>
        <postfield name="txt" value="$(txt<%=Runtxt%>)"/>
        <postfield name="vip" value="$(vip<%=Runtxt%>)"/>
        <postfield name="viphy" value="$(viphy<%=Runtxt%>)"/>
        <postfield name="zf" value="$(zf<%=Runtxt%>)"/>
        <postfield name="zuozhe" value="$(zuozhe<%=Runtxt%>)"/>
        <postfield name="laiyuan" value="$(laiyuan<%=Runtxt%>)"/>
        <postfield name="tuurl" value="$(tuurl<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>

<%
		end if
		rs.Close
		Set rs = Nothing
%>

-------------<br/>
<a href='filelist.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回软件管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function


Function login
	dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

		dim rs,sql,errs,classid,fleg,Path,txtid,id
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

    		id = Request("id")    
    		If id = "" Then id = 1
   		If Not IsNumeric(id) Then id = 1
    		id = CLng(id)
    		If id < 1 Then id = 1

		dim cid,name,tuijian,txt,vip,zf,zuozhe,laiyuan,fileurl,fileext,filesize,viphy,tuurl,namet
        cid=Request.form("cid")
        name=Request.form("name")
        tuijian=Request.form("tuijian")
        txt=Request.form("txt")
        tuurl=Request.form("tuurl")
        vip=Request.form("vip")
        zf=Request.form("zf")
        zuozhe=Request.form("zuozhe")
        laiyuan=Request.form("laiyuan")
 	viphy=TRim(Request.Form("viphy"))
        if tuurl="" then tuurl="/img/file.gif"
		errs=""
	if txt=""  then errs=errs&"名称不能为空<br/>"
	if cid=""  then errs=errs&"分类不能为空<br/>"
	if not isnumeric(classid) then errs=errs&"分类必须为数字<br/>"
	if tuijian=""  then errs=errs&"推荐不能为空<br/>"
	if not isnumeric(tuijian) then errs=errs&"推荐必须为数字<br/>"
	if vip=""  then errs=errs&"VIP不能为空<br/>"
	if not isnumeric(vip) then errs=errs&"VIP必须为数字<br/>"
	if zf=""  then errs=errs&"金币不能为空<br/>"
	if not isnumeric(zf) then errs=errs&"金币必须为数字<br/>"
	if viphy=""  then errs=errs&"VIP会员查看不能为空<br/>"
	if not isnumeric(viphy) then errs=errs&"VIP会员查看必须为数字<br/>"
	%>
	<card id="login" title="编辑软件资源"><p align="left">
	<%
	IF len(errs)=0 then
      namet=conn.execute("select name from [qingtian_phonefen] where id="&CLng(cid)&"")("name")
          	set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select top 1 *  FROM qingtian_fileli where id="&id&""
		rs.open sql,conn,1,3
			rs("tuijian")=CLng(tuijian)
			rs("name")=name
			rs("namet")=namet
			rs("leiid")=CLng(cid)
			rs("tuurl")=tuurl
			rs("zf")=CLng(zf)
			rs("vip")=CLng(vip)
			rs("content")=txt
			rs("viphy")=CLng(viphy)
		rs.update()
		rs.Close
		Set rs = Nothing
		%>
内容编辑成功,请继续编辑连接地址.
<br/>----------------<br/>
<a href='editfilelist2.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;id=<%=id%>&amp;sid=<%=sid%>'>编辑连接地址</a><br/>
<a href='editfilelist1.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;id=<%=id%>&amp;sid=<%=sid%>'>返回继续编辑</a><br/>
<%

	else%>
		<%=errs%>
		<a href='editfilelist1.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;id=<%=id%>&amp;sid=<%=sid%>'>返回继续编辑</a><br/>
<%	end if
%>
<a href='filelist.asp?classid=<%=classid%>&amp;page=<%=page%>&amp;sid=<%=sid%>'>返回下载管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>

